package day0729;

import javax.swing.*;
import java.util.Arrays;

public class GameMain {
    Bullet[]  bs={};
    //创建子弹，保存到bs数组中。
    void startGame(){//运行运行的核心代码;
        while(true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            createBullets();
        }
    }

    private void createBullets() {
        Bullet bullet = new Bullet();
        bs=Arrays.copyOf(bs,  bs.length+1);
        bs[bs.length-1]=bullet;
        System.out.println(bs.length);
    }

    public static void main(String[] args) {
        JFrame win=new JFrame();//创建窗口
        win.setSize(480,800);
        win.setVisible(true);//设置可见性

        GameMain gm=new GameMain();
        gm.startGame();
    }


}
